<!Doctype html>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<meta name="viewport" content="width=device-width, initial-scale=1.0" />
	<title>JavaScript Console 对象 | 菜鸟教程</title>

  <meta name='robots' content='max-image-preview:large' />
<link rel='stylesheet' id='classic-theme-styles-css' href='../0/classic-themes.min.css?ver=6.2' type='text/css' media='all' />
<link rel="canonical" href="../w3cnote/javascript-console-object.html" />
<meta name="keywords" content="JavaScript Console 对象">
<meta name="description" content="Console 对象用于 JavaScript 调试。  JavaScript 原生中默认是没有 Console 对象，这是宿主对象（也就是浏览器）提供的内置对象。 用于访问调试控制台, 在不同的浏览器里效果可能不同。  Console 对象常见的两个用途：  显示网页代码运行时的错误信息。  提供了一个命令行接口，用来与网页代码互动。   以 Chrome浏览器为例，我们可以通过按 F12 或者 Control+Shift+i（PC平..">
		
	<link rel="shortcut icon" href="https://static.runoob.com/images/favicon.ico">
	<link rel="stylesheet" href="../0/style.css?v=1.170" type="text/css" media="all" />	
	<link rel="stylesheet" href="../0/font-awesome.min.css" media="all" />	
  <!--[if gte IE 9]><!-->
  <script src=""></script>
  <!--<![endif]-->
  <!--[if lt IE 9]>
     <script src=""></script>
     <script src=""></script>
  <![endif]-->
  <link rel="apple-touch-icon" href="https://static.runoob.com/images/icon/mobile-icon.png"/>
  <meta name="apple-mobile-web-app-title" content="菜鸟教程">
</head>
<body>

<!--  头部 -->
<div class="container logo-search">

  <div class="col search row-search-mobile">
    <form action="index.php">
      <input class="placeholder" placeholder="搜索……" name="s" autocomplete="off">
      
    </form>
  </div>

  <div class="row">
    <div class="col logo">
      <h1><a href="../">菜鸟教程 -- 学的不仅是技术，更是梦想！</a></h1>
    </div>
        <div class="col right-list"> 
    <button class="btn btn-responsive-nav btn-inverse" data-toggle="collapse" data-target=".nav-main-collapse" id="pull" style=""> <i class="fa fa-navicon"></i> </button>
    </div>
        
    <div class="col search search-desktop last">
      <div class="search-input" >
      <form action="//www.runoob.com/" target="_blank">
        <input class="placeholder" id="s" name="s" placeholder="搜索……"  autocomplete="off" style="height: 44px;">
      </form>
      
      </div>
    </div>
  </div>
</div>



<!-- 导航栏 -->
<div class="container navigation">
    <div class="row">
        <div class="col nav">
            

                        <ul class="pc-nav" id="note-nav">
                <li><a href="../">首页</a></li>
                <li><a href="../w3cnote">笔记首页</a></li>
                <li><a href="../w3cnote/android-tutorial-intro.html" title="Android 基础入门教程">Android</a></li>
                <li><a href="../w3cnote/es6-tutorial.html" title="ES6 教程">ES6 教程</a></li>
                <li><a href="../w3cnote/ten-sorting-algorithm.html" title="排序算法">排序算法</a></li>
                <li><a href="../w3cnote/hadoop-tutorial.html" title="Hadoop 教程">Hadoop</a></li>
                <li><a href="../w3cnote/zookeeper-tutorial.html" title="Zookeeper 教程">Zookeeper</a></li>
                <li><a href="../w3cnote/verilog-tutorial.html" title="Verilog 教程">Verilog</a></li>
                <li><a href="../w3cnote_genre/code" title="编程技术">编程技术</a></li> 
                <li><a href="../w3cnote_genre/coderlife" title="程序员人生">程序员人生</a></li>
                
                <!--<li><a href="javascript:;" class="runoob-pop">登录</a></li>
                
                
                        <li>
                <a style="font-weight:bold;" href="../linux/linux-tutorial.html#yunserver" target="_blank" onclick="_hmt.push(['_trackEvent', 'aliyun', 'click', 'aliyun'])" title="kkb">云服务器</a>
                </li>
                <li><a href="http://gk.link/a/104mQ" target="_blank" style="font-weight: bold;"onclick="_hmt.push(['_trackEvent', '极客时间', 'click', 'jike'])" title="我的圈子">极客时间</a></li>
            
                
                <li><a target="_blank" href="../shoppinglist" rel="nofollow">知识店铺</a></li> 
        -->
            </ul>
                        
              
            <ul class="mobile-nav">
                <li><a href="../w3cnote">首页</a></li>
                <li><a href="../w3cnote_genre/android" target="_blank" title="Android 基础入门教程">Android</a></li>
                <li><a href="../w3cnote/es6-tutorial.html" target="_blank" title="ES6 教程">ES6</a></li>
                <li><a href="../w3cnote_genre/joke" target="_blank" title="程序员笑话">逗乐</a></li>
                
                <a href="javascript:void(0)" class="search-reveal">Search</a> 
            </ul>
            
        </div>
    </div>
</div>


<!--  内容  -->
<div class="container main">
	<div class="row">

		<div class="col middle-column big-middle-column">
	 			<div class="article">
			<div class="article-heading">
				<h2>JavaScript Console 对象</h2>				<h3><em>分类</em> <a href="../w3cnote_genre/code" title="编程技术" >编程技术</a> </h3>
			</div>
			<div class="article-body note-body">
				<div class="article-intro">
					<p>Console 对象用于 JavaScript 调试。</p>

<p>JavaScript 原生中默认是没有 Console 对象，这是宿主对象（也就是浏览器）提供的内置对象。 用于访问调试控制台, 在不同的浏览器里效果可能不同。</p>

<p>Console 对象常见的两个用途：</p>
<ul><li>
显示网页代码运行时的错误信息。
</li><li>
提供了一个命令行接口，用来与网页代码互动。
</li></ul>

<p>以 Chrome浏览器为例，我们可以通过按 F12 或者 Control+Shift+i（PC平台）/ Alt+Command+i（Mac平台）来打开 Console 窗口。</p>
<img decoding="async" src="//www.runoob.com/wp-content/uploads/2017/09/B045332B-5770-4630-80BE-1D6593BFF052.jpg"></p>

<hr><h2>
Console 对象方法
</h2>
<table class="reference">
  <tbody><tr>
    <th style="width:15%">方法</th>
    <th style="width:30%">描述</th>
    <th>实例</th>
  </tr>
    <tr>
    <td>assert()</td>
    <td>assert方法接受两个参数，第一个参数是表达式，第二个参数是字符串。只有当第一个参数为false，才会输出第二个参数，否则不会有任何结果。</td>
    <td>
<pre>
// 实例
console.assert(true === false, "判断条件不成立")
// Assertion failed: 判断条件不成立
</pre></td>
    </tr>
  <tr>
    <td>clear()</td>
    <td>清除当前控制台的所有输出，将光标回置到第一行。</td>
    <td><pre>console.clear()</pre></td>
    </tr>
  <tr>
    <td>count()</td>
    <td>用于计数，输出它被调用了多少次。</td>
    <td>
<pre>
(function() {
  for (var i = 0; i &lt; 5; i++) { 
    console.count('count'); 
  }
})();</pre></td>
    </tr>
  <tr>
    <td>error()</td>
    <td>输出信息时，在最前面加一个红色的叉，表示出错，同时会显示错误发生的堆栈。</td>
    <td><pre>console.error("Error: %s (%i)", "Server is not responding",500)</pre></td>
    </tr>
  <tr>
    <td>group()</td>
    <td>用于将显示的信息分组，可以把信息进行折叠和展开。</td>
    <td>
<pre>
console.group('第一层');
  console.group('第二层');

    console.log('error');
    console.error('error');
    console.warn('error');

  console.groupEnd(); 
console.groupEnd();</pre></td>

    </tr>
  <tr>
    <td>groupCollapsed()</td>
    <td>与console.group方法很类似，唯一的区别是该组的内容，在第一次显示时是收起的（collapsed），而不是展开的。</td>
    <td>
<pre>
console.groupCollapsed('第一层');
  console.groupCollapsed('第二层');

    console.log('error');
    console.error('error');
    console.warn('error');

  console.groupEnd(); 
console.groupEnd();
</pre></td>
    </tr>
  <tr>
    <td>groupEnd()</td>
    <td>结束内联分组</td>
    <td>
<pre>
console.group('Group One');
console.group('Group Two');

// some code

console.groupEnd(); // Group Two 结束
console.groupEnd(); // Group One 结束
</pre></td>
    </tr>
  <tr>
    <td>info()</td>
    <td>console.log 别名，输出信息</td>
    <td><pre>console.info("runoob")</pre></td>
    </tr>
  <tr>
    <td>log()</td>
    <td>输出信息</td><td><pre>console.log("runoob")</pre></td>
    </tr>
  <tr>
    <td>table()</td>
    <td>将复合类型的数据转为表格显示。</td>
    <td>
<pre>
var arr= [ 
         { num: "1"},
         { num: "2"}, 
         { num: "3" }
    ];
console.table(arr);

var obj= {
     a:{ num: "1"},
     b:{ num: "2"},
     c:{ num: "3" }
};
console.table(obj);
</pre></td>
    </tr>
  <tr>
    <td>time()</td>
    <td>计时开始</td>
    <td>
<pre>
console.time('计时器1');
for (var i = 0; i &lt; 100; i++) {
  for (var j = 0; j &lt; 100; j++) {}
}
console.timeEnd('计时器1');
console.time('计时器2');
for (var i = 0; i &lt; 1000; i++) {
  for (var j = 0; j &lt; 1000; j++) {}
}
console.timeEnd('计时器2');
</pre></td>
    </tr>
  <tr>
    <td>timeEnd()</td>
    <td>计时结束</td>
    <td>
<pre>
console.time('计时器1');
for (var i = 0; i &lt; 100; i++) {
  for (var j = 0; j &lt; 100; j++) {}
}
console.timeEnd('计时器1');
console.time('计时器2');
for (var i = 0; i &lt; 1000; i++) {
  for (var j = 0; j &lt; 1000; j++) {}
}
console.timeEnd('计时器2');
</pre></td>
    </tr>
  <tr>
    <td>trace()</td>
    <td>追踪函数的调用过程</td>
    <td><pre>
function d(a) { 
  console.trace();
  return a;
}
function b(a) { 
  return c(a);
}
function c(a) { 
  return d(a);
}
var a = b('123');
</pre></td>
    </tr>
  <tr>
    <td>warn()</td>
    <td>输出警告信息</td>
    <td><pre>console.warn("警告")</pre></td>
    </tr>
</tbody></table>
<hr><h2>常用 Console 调试命令
</h2>
<div class="example">
<h2 class="example">实例</h2>
<div class="example_code">
<div class="hl-main"><span class="hl-identifier">console</span><span class="hl-code">.</span><span class="hl-identifier">log</span><span class="hl-brackets">(</span><span class="hl-quotes">'</span><span class="hl-string">hello</span><span class="hl-quotes">'</span><span class="hl-brackets">)</span><span class="hl-code">;
</span><span class="hl-identifier">console</span><span class="hl-code">.</span><span class="hl-identifier">info</span><span class="hl-brackets">(</span><span class="hl-quotes">'</span><span class="hl-string">信息</span><span class="hl-quotes">'</span><span class="hl-brackets">)</span><span class="hl-code">;
</span><span class="hl-identifier">console</span><span class="hl-code">.</span><span class="hl-identifier">error</span><span class="hl-brackets">(</span><span class="hl-quotes">'</span><span class="hl-string">错误</span><span class="hl-quotes">'</span><span class="hl-brackets">)</span><span class="hl-code">;
</span><span class="hl-identifier">console</span><span class="hl-code">.</span><span class="hl-identifier">warn</span><span class="hl-brackets">(</span><span class="hl-quotes">'</span><span class="hl-string">警告</span><span class="hl-quotes">'</span><span class="hl-brackets">)</span><span class="hl-code">;</span></div>
</div>
<br>
<a target="_blank" href="https://c.runoob.com/codedemo/3832" class="tryitbtn" rel="noopener noreferrer">尝试一下 »</a>
</div>
<p><img decoding="async" src="//www.runoob.com/wp-content/uploads/2017/09/1E70A702-434A-46AB-BBD7-17CB0853E19A.jpg"></p>
<p>最常用的就是 console.log 了。</p>
<p>console上述的集中度支持printf的占位符格式，支持的占位符有：字符（%s）、整数（%d或%i）、浮点数（%f）和对象（%o）:</p>

<table class="reference">
<thead>
<tr>
<th align="center">占位符</th>
<th align="center">作用</th>
</tr>
</thead>
<tbody>
<tr>
<td align="center">%s</td>
<td align="center">字符串</td>
</tr>
<tr>
<td align="center">%d or %i</td>
<td align="center">整数</td>
</tr>
<tr>
<td align="center">%f</td>
<td align="center">浮点数</td>
</tr>
<tr>
<td align="center">%o</td>
<td align="center">可展开的DOM</td>
</tr>
<tr>
<td align="center">%O</td>
<td align="center">列出DOM的属性</td>
</tr>
<tr>
<td align="center">%c</td>
<td align="center">根据提供的css样式格式化字符串</td>
</tr></tbody></table>
<div class="example">
<h2 class="example">实例</h2>
<div class="example_code">
<div class="hl-main"><span class="hl-identifier">console</span><span class="hl-code">.</span><span class="hl-identifier">log</span><span class="hl-brackets">(</span><span class="hl-quotes">&quot;</span><span class="hl-string">%d年%d月%d日</span><span class="hl-quotes">&quot;</span><span class="hl-code">,</span><span class="hl-number">2011</span><span class="hl-code">,</span><span class="hl-number">3</span><span class="hl-code">,</span><span class="hl-number">26</span><span class="hl-brackets">)</span><span class="hl-code">;</span></div>
</div>
<br>
<a target="_blank" href="https://c.runoob.com/codedemo/3833" class="tryitbtn" rel="noopener noreferrer">尝试一下 »</a>
</div>
<p>效果：</p>
<p><img decoding="async" src="//www.runoob.com/wp-content/uploads/2013/06/BF64EF3C-F2D9-48A2-AC34-0D3AA7BF528E.jpg"></p>
<p>%o、%O 都是用来输出 Object 对象的，对普通的 Object 对象，两者没区别，但是打印dom节点时就不一样了：</p>
<div class="example">
<h2 class="example">实例</h2>
<div class="example_code">
<div class="hl-main"><span class="hl-comment">//</span><span class="hl-comment"> 格式成可展开的的DOM，像在开发者工具Element面板那样可展开 </span><span class="hl-comment"></span><span class="hl-code">
</span><span class="hl-identifier">console</span><span class="hl-code">.</span><span class="hl-identifier">log</span><span class="hl-brackets">(</span><span class="hl-quotes">'</span><span class="hl-string">%o</span><span class="hl-quotes">'</span><span class="hl-code">,</span><span class="hl-builtin">document</span><span class="hl-code">.</span><span class="hl-identifier">body</span><span class="hl-code">.</span><span class="hl-identifier">firstElementChild</span><span class="hl-brackets">)</span><span class="hl-code">; 
</span><span class="hl-comment">//</span><span class="hl-comment"> 像JS对象那样访问DOM元素，可查看DOM元素的属性 </span><span class="hl-comment"></span><span class="hl-code">
</span><span class="hl-comment">//</span><span class="hl-comment"> 等同于console.dir(document.body.firstElementChild) </span><span class="hl-comment"></span><span class="hl-code">
</span><span class="hl-identifier">console</span><span class="hl-code">.</span><span class="hl-identifier">log</span><span class="hl-brackets">(</span><span class="hl-quotes">'</span><span class="hl-string">%O</span><span class="hl-quotes">'</span><span class="hl-code">,</span><span class="hl-builtin">document</span><span class="hl-code">.</span><span class="hl-identifier">body</span><span class="hl-code">.</span><span class="hl-identifier">firstElementChild</span><span class="hl-brackets">)</span><span class="hl-code">;</span></div>
</div>
<br>
<a target="_blank" href="https://c.runoob.com/codedemo/3834" class="tryitbtn" rel="noopener noreferrer">尝试一下 »</a>
</div><p>效果：</p>
<p><img decoding="async" src="//www.runoob.com/wp-content/uploads/2017/09/64741BFE-863B-4A27-AB60-6B05FEE113C9.jpg"></p>
<p>%c 占位符是最常用的。使用 %c 占位符时，对应的后面的参数必须是 CSS 语句，用来对输出内容进行 CSS 渲染。常见的输出方式有两种：文字样式、图片输出。</p>
<p><strong>文字输出</strong></p>
<div class="example">
<h2 class="example">实例</h2>
<div class="example_code">
<div class="hl-main"><span class="hl-identifier">console</span><span class="hl-code">.</span><span class="hl-identifier">log</span><span class="hl-brackets">(</span><span class="hl-quotes">&quot;</span><span class="hl-string">%c菜鸟教程！</span><span class="hl-quotes">&quot;</span><span class="hl-code">,</span><span class="hl-quotes">&quot;</span><span class="hl-string">color: red; font-size: 20px</span><span class="hl-quotes">&quot;</span><span class="hl-brackets">)</span><span class="hl-code">; 
</span><span class="hl-comment">//</span><span class="hl-comment">输出红色的、20px大小的字符串：菜鸟教程,欢迎您！</span><span class="hl-comment"></span></div>
</div>
<br>
<a target="_blank" href="https://c.runoob.com/codedemo/3835" class="tryitbtn" rel="noopener noreferrer">尝试一下 »</a>
</div>
<p>效果：</p>
<p><img decoding="async" src="//www.runoob.com/wp-content/uploads/2017/09/2E547114-1D27-4372-AE14-5CD1779CE9E4.jpg"></p>

<p>除了普通文本，还能输出面板一样的字符画。这些字符画是可以在线生成的：</p>
<ul>
<li><a href="http://picascii.com/" target="_blank" rel="noopener noreferrer">picascii</a></li>
<li><a href="http://www.degraeve.com/img2txt.php" target="_blank" rel="noopener noreferrer">mg2txt</a></li>
<li><a href="http://www.network-science.de/ascii/" target="_blank" rel="noopener noreferrer">Ascii generator</a></li>
</ul>

<p>大概方法：使用在线工具生成字符画，然后复制到sublime中，将每行开头的换行删除，且替换成\n。最后只有一行代码，即保证没有换行，最后再丢到 console.log("")代码中即可，当然，也可以添加结合 %c 做出更酷炫的效果(console 输出默认是不换行的)。</p>
<p><strong>图片输出</strong></p>
<div class="example">
<h2 class="example">实例</h2>
<div class="example_code">
<div class="hl-main"><span class="hl-identifier">console</span><span class="hl-code">.</span><span class="hl-identifier">log</span><span class="hl-brackets">(</span><span class="hl-quotes">&quot;</span><span class="hl-string">%c</span><span class="hl-quotes">&quot;</span><span class="hl-code">,</span><span class="hl-quotes">&quot;</span><span class="hl-string">background:url(https://static.runoob.com/images/runoob-logo.png) no-repeat;padding:50px 300px;line-height:120px</span><span class="hl-quotes">&quot;</span><span class="hl-brackets">)</span><span class="hl-code">;</span></div>
</div>
<br>
<a target="_blank" href="https://c.runoob.com/codedemo/3836" class="tryitbtn" rel="noopener noreferrer">尝试一下 »</a>
</div>
<p><img decoding="async" src="//www.runoob.com/wp-content/uploads/2017/09/C78A939E-0316-4729-BCA9-5C7D18221941.jpg"></p>
<p>由于 console 不能定义 img，因此用背景图片代替。此外，console 不支持 width 和 height，利用空格和 font-size 代替；还可以使用 padding 和 line-height 代替宽高。</p>
<h2>三、信息分组</h2>
<div class="example">
<h2 class="example">实例</h2>
<div class="example_code">
<div class="hl-main"><span class="hl-identifier">console</span><span class="hl-code">.</span><span class="hl-identifier">group</span><span class="hl-brackets">(</span><span class="hl-quotes">&quot;</span><span class="hl-string">第一组信息</span><span class="hl-quotes">&quot;</span><span class="hl-brackets">)</span><span class="hl-code">;
  </span><span class="hl-identifier">console</span><span class="hl-code">.</span><span class="hl-identifier">log</span><span class="hl-brackets">(</span><span class="hl-quotes">&quot;</span><span class="hl-string">第一组第一条</span><span class="hl-quotes">&quot;</span><span class="hl-brackets">)</span><span class="hl-code">;
  </span><span class="hl-identifier">console</span><span class="hl-code">.</span><span class="hl-identifier">log</span><span class="hl-brackets">(</span><span class="hl-quotes">&quot;</span><span class="hl-string">第一组第二条</span><span class="hl-quotes">&quot;</span><span class="hl-brackets">)</span><span class="hl-code">;
</span><span class="hl-identifier">console</span><span class="hl-code">.</span><span class="hl-identifier">groupEnd</span><span class="hl-brackets">(</span><span class="hl-brackets">)</span><span class="hl-code">;
  
</span><span class="hl-identifier">console</span><span class="hl-code">.</span><span class="hl-identifier">group</span><span class="hl-brackets">(</span><span class="hl-quotes">&quot;</span><span class="hl-string">第二组信息</span><span class="hl-quotes">&quot;</span><span class="hl-brackets">)</span><span class="hl-code">;
  </span><span class="hl-identifier">console</span><span class="hl-code">.</span><span class="hl-identifier">log</span><span class="hl-brackets">(</span><span class="hl-quotes">&quot;</span><span class="hl-string">第二组第一条</span><span class="hl-quotes">&quot;</span><span class="hl-brackets">)</span><span class="hl-code">;
  </span><span class="hl-identifier">console</span><span class="hl-code">.</span><span class="hl-identifier">log</span><span class="hl-brackets">(</span><span class="hl-quotes">&quot;</span><span class="hl-string">第二组第二条</span><span class="hl-quotes">&quot;</span><span class="hl-brackets">)</span><span class="hl-code">;
</span><span class="hl-identifier">console</span><span class="hl-code">.</span><span class="hl-identifier">groupEnd</span><span class="hl-brackets">(</span><span class="hl-brackets">)</span><span class="hl-code">;</span></div>
</div>
<br>
<a target="_blank" href="https://c.runoob.com/codedemo/3837" class="tryitbtn" rel="noopener noreferrer">尝试一下 »</a>
</div>
<p><img decoding="async" src="//www.runoob.com/wp-content/uploads/2017/09/8F537339-88D1-49A2-8E3E-CB19F9019019.jpg"></p>

<h2>四、查看对象的信息</h2>
<div class="example">
<h2 class="example">实例</h2>
<div class="example_code">
<div class="hl-main"><span class="hl-reserved">var</span><span class="hl-code"> </span><span class="hl-identifier">info</span><span class="hl-code"> = </span><span class="hl-brackets">{</span><span class="hl-code">
  </span><span class="hl-identifier">site</span><span class="hl-code">:</span><span class="hl-quotes">&quot;</span><span class="hl-string">http://www.runoob.com</span><span class="hl-quotes">&quot;</span><span class="hl-code">,
  </span><span class="hl-identifier">name</span><span class="hl-code">:</span><span class="hl-quotes">&quot;</span><span class="hl-string">菜鸟教程</span><span class="hl-quotes">&quot;</span><span class="hl-code">
</span><span class="hl-brackets">}</span><span class="hl-code">;
</span><span class="hl-identifier">console</span><span class="hl-code">.</span><span class="hl-identifier">dir</span><span class="hl-brackets">(</span><span class="hl-identifier">info</span><span class="hl-brackets">)</span><span class="hl-code">;</span></div>
</div>
<br>
<a target="_blank" href="https://c.runoob.com/codedemo/3838" class="tryitbtn" rel="noopener noreferrer">尝试一下 »</a>
</div><p><img decoding="async" src="//www.runoob.com/wp-content/uploads/2017/09/0632A5AC-1DFD-4BE6-8ABA-833D48DC2916.jpg"></p>


<h2>五、显示某个节点的内容</h2>
<p>console.dirxml()用来显示网页的某个节点（node）所包含的html/xml代码。</p>
<div class="example">
<h2 class="example">实例</h2>
<div class="example_code">
<div class="hl-main"><span class="hl-brackets">&lt;</span><span class="hl-reserved">div</span><span class="hl-code"> </span><span class="hl-var">id</span><span class="hl-code">=</span><span class="hl-quotes">&quot;</span><span class="hl-string">info</span><span class="hl-quotes">&quot;</span><span class="hl-brackets">&gt;</span><span class="hl-code">
  </span><span class="hl-brackets">&lt;</span><span class="hl-reserved">h3</span><span class="hl-brackets">&gt;</span><span class="hl-code">菜鸟教程</span><span class="hl-brackets">&lt;/</span><span class="hl-reserved">h3</span><span class="hl-brackets">&gt;</span><span class="hl-code">
  </span><span class="hl-brackets">&lt;</span><span class="hl-reserved">p</span><span class="hl-brackets">&gt;</span><span class="hl-code">学的不仅是技术，更是梦想！</span><span class="hl-brackets">&lt;/</span><span class="hl-reserved">p</span><span class="hl-brackets">&gt;</span><span class="hl-code">
</span><span class="hl-brackets">&lt;/</span><span class="hl-reserved">div</span><span class="hl-brackets">&gt;</span><span class="hl-code">
</span><span class="hl-brackets">&lt;</span><span class="hl-reserved">script</span><span class="hl-code"> </span><span class="hl-var">type</span><span class="hl-code">=</span><span class="hl-quotes">&quot;</span><span class="hl-string">text/javascript</span><span class="hl-quotes">&quot;</span><span class="hl-brackets">&gt;</span><span class="hl-code">
  var info = document.getElementById('info');
  console.dirxml(info);
</span><span class="hl-brackets">&lt;/</span><span class="hl-reserved">script</span><span class="hl-brackets">&gt;</span></div>
</div>
<br>
<a target="_blank" href="https://c.runoob.com/codedemo/3840" class="tryitbtn" rel="noopener noreferrer">尝试一下 »</a>
</div>
<p><img decoding="async" src="//www.runoob.com/wp-content/uploads/2017/09/0054765E-84BE-4D05-8CE1-DB84F9B57211.jpg"></p>


<h2>六、判断变量是否是真</h2>

<p>console.assert()用来判断一个表达式或变量是否为真。如果结果为否，则在控制台输出一条相应信息，并且抛出一个异常。</p>
<div class="example">
<h2 class="example">实例</h2>
<div class="example_code">
<div class="hl-main"><span class="hl-reserved">var</span><span class="hl-code"> </span><span class="hl-identifier">result</span><span class="hl-code"> = </span><span class="hl-number">1</span><span class="hl-code">;
</span><span class="hl-identifier">console</span><span class="hl-code">.</span><span class="hl-identifier">assert</span><span class="hl-brackets">(</span><span class="hl-code"> </span><span class="hl-identifier">result</span><span class="hl-code"> </span><span class="hl-brackets">)</span><span class="hl-code">;
</span><span class="hl-reserved">var</span><span class="hl-code"> </span><span class="hl-identifier">year</span><span class="hl-code"> = </span><span class="hl-number">2014</span><span class="hl-code">;
</span><span class="hl-identifier">console</span><span class="hl-code">.</span><span class="hl-identifier">assert</span><span class="hl-brackets">(</span><span class="hl-identifier">year</span><span class="hl-code"> == </span><span class="hl-number">2018</span><span class="hl-code"> </span><span class="hl-brackets">)</span><span class="hl-code">;</span></div>
</div>
<br>
<a target="_blank" href="https://c.runoob.com/codedemo/3841" class="tryitbtn" rel="noopener noreferrer">尝试一下 »</a>
</div>
<p>1 是非 0 值，为 true ；而第二个判断是 false，在控制台显示错误信息。</p>
<p><img decoding="async" src="//www.runoob.com/wp-content/uploads/2017/09/F93B7697-DCC6-4BF5-9DD2-60E9B13DA767.jpg"></p>
<h2>七、追踪函数的调用轨迹</h2>
<p>console.trace() 用来追踪函数的调用轨迹。</p>
<div class="example">
<h2 class="example">实例</h2>
<div class="example_code">
<div class="hl-main"><span class="hl-comment">/*</span><span class="hl-comment">函数是如何被调用的，在其中加入console.trace()方法就可以了</span><span class="hl-comment">*/</span><span class="hl-code">
</span><span class="hl-reserved">function</span><span class="hl-code"> </span><span class="hl-identifier">add</span><span class="hl-brackets">(</span><span class="hl-identifier">a</span><span class="hl-code">,</span><span class="hl-identifier">b</span><span class="hl-brackets">)</span><span class="hl-brackets">{</span><span class="hl-code">
  </span><span class="hl-identifier">console</span><span class="hl-code">.</span><span class="hl-identifier">trace</span><span class="hl-brackets">(</span><span class="hl-brackets">)</span><span class="hl-code">;
  </span><span class="hl-reserved">return</span><span class="hl-code"> </span><span class="hl-identifier">a</span><span class="hl-code">+</span><span class="hl-identifier">b</span><span class="hl-code">;
</span><span class="hl-brackets">}</span><span class="hl-code">
</span><span class="hl-reserved">var</span><span class="hl-code"> </span><span class="hl-identifier">x</span><span class="hl-code"> = </span><span class="hl-identifier">add3</span><span class="hl-brackets">(</span><span class="hl-number">1</span><span class="hl-code">,</span><span class="hl-number">1</span><span class="hl-brackets">)</span><span class="hl-code">;
</span><span class="hl-reserved">function</span><span class="hl-code"> </span><span class="hl-identifier">add3</span><span class="hl-brackets">(</span><span class="hl-identifier">a</span><span class="hl-code">,</span><span class="hl-identifier">b</span><span class="hl-brackets">)</span><span class="hl-brackets">{</span><span class="hl-reserved">return</span><span class="hl-code"> </span><span class="hl-identifier">add2</span><span class="hl-brackets">(</span><span class="hl-identifier">a</span><span class="hl-code">,</span><span class="hl-identifier">b</span><span class="hl-brackets">)</span><span class="hl-code">;</span><span class="hl-brackets">}</span><span class="hl-code">
</span><span class="hl-reserved">function</span><span class="hl-code"> </span><span class="hl-identifier">add2</span><span class="hl-brackets">(</span><span class="hl-identifier">a</span><span class="hl-code">,</span><span class="hl-identifier">b</span><span class="hl-brackets">)</span><span class="hl-brackets">{</span><span class="hl-reserved">return</span><span class="hl-code"> </span><span class="hl-identifier">add1</span><span class="hl-brackets">(</span><span class="hl-identifier">a</span><span class="hl-code">,</span><span class="hl-identifier">b</span><span class="hl-brackets">)</span><span class="hl-code">;</span><span class="hl-brackets">}</span><span class="hl-code">
</span><span class="hl-reserved">function</span><span class="hl-code"> </span><span class="hl-identifier">add1</span><span class="hl-brackets">(</span><span class="hl-identifier">a</span><span class="hl-code">,</span><span class="hl-identifier">b</span><span class="hl-brackets">)</span><span class="hl-brackets">{</span><span class="hl-reserved">return</span><span class="hl-code"> </span><span class="hl-identifier">add</span><span class="hl-brackets">(</span><span class="hl-identifier">a</span><span class="hl-code">,</span><span class="hl-identifier">b</span><span class="hl-brackets">)</span><span class="hl-code">;</span><span class="hl-brackets">}</span></div>
</div>
<br>
<a target="_blank" href="https://c.runoob.com/codedemo/3842" class="tryitbtn" rel="noopener noreferrer">尝试一下 »</a>
</div>


<p>控制台输出信息：</p><p><img decoding="async" src="//www.runoob.com/wp-content/uploads/2017/09/CB6D4AB4-48AC-4A7A-8301-423C2E69011A.jpg"></p>
<h2>八、计时功能</h2>
<p>console.time() 和 console.timeEnd()，用来显示代码的运行时间。</p>
<div class="example">
<h2 class="example">实例</h2>
<div class="example_code">
<div class="hl-main"><span class="hl-identifier">console</span><span class="hl-code">.</span><span class="hl-identifier">time</span><span class="hl-brackets">(</span><span class="hl-quotes">&quot;</span><span class="hl-string">控制台计时器一</span><span class="hl-quotes">&quot;</span><span class="hl-brackets">)</span><span class="hl-code">;
</span><span class="hl-reserved">for</span><span class="hl-brackets">(</span><span class="hl-reserved">var</span><span class="hl-code"> </span><span class="hl-identifier">i</span><span class="hl-code">=</span><span class="hl-number">0</span><span class="hl-code">;</span><span class="hl-identifier">i</span><span class="hl-code">&lt;</span><span class="hl-number">1000</span><span class="hl-code">;</span><span class="hl-identifier">i</span><span class="hl-code">++</span><span class="hl-brackets">)</span><span class="hl-brackets">{</span><span class="hl-code">
  </span><span class="hl-reserved">for</span><span class="hl-brackets">(</span><span class="hl-reserved">var</span><span class="hl-code"> </span><span class="hl-identifier">j</span><span class="hl-code">=</span><span class="hl-number">0</span><span class="hl-code">;</span><span class="hl-identifier">j</span><span class="hl-code">&lt;</span><span class="hl-number">1000</span><span class="hl-code">;</span><span class="hl-identifier">j</span><span class="hl-code">++</span><span class="hl-brackets">)</span><span class="hl-brackets">{</span><span class="hl-brackets">}</span><span class="hl-code">
</span><span class="hl-brackets">}</span><span class="hl-code">
</span><span class="hl-identifier">console</span><span class="hl-code">.</span><span class="hl-identifier">timeEnd</span><span class="hl-brackets">(</span><span class="hl-quotes">&quot;</span><span class="hl-string">控制台计时器一</span><span class="hl-quotes">&quot;</span><span class="hl-brackets">)</span><span class="hl-code">;</span></div>
</div>
<br>
<a target="_blank" href="https://c.runoob.com/codedemo/3843" class="tryitbtn" rel="noopener noreferrer">尝试一下 »</a>
</div>
<p><img decoding="async" src="//www.runoob.com/wp-content/uploads/2017/09/67339176-7A8A-4CF8-92B6-FD6C68B6F632.jpg"></p>
<h2>九、console.profile() 的性能分析</h2>
<p>性能分析（Profiler）就是分析程序各个部分的运行时间，找出瓶颈所在，使用的方法是 console.profile()。</p>
<div class="example">
<h2 class="example">实例</h2>
<div class="example_code">
<div class="hl-main"><span class="hl-reserved">function</span><span class="hl-code"> </span><span class="hl-identifier">All</span><span class="hl-brackets">(</span><span class="hl-brackets">)</span><span class="hl-code"> </span><span class="hl-brackets">{</span><span class="hl-code">
  </span><span class="hl-identifier">alert</span><span class="hl-brackets">(</span><span class="hl-number">1</span><span class="hl-brackets">)</span><span class="hl-code">;
  </span><span class="hl-reserved">for</span><span class="hl-code"> </span><span class="hl-brackets">(</span><span class="hl-reserved">var</span><span class="hl-code"> </span><span class="hl-identifier">i</span><span class="hl-code"> = </span><span class="hl-number">0</span><span class="hl-code">; </span><span class="hl-identifier">i</span><span class="hl-code"> &lt; </span><span class="hl-number">10</span><span class="hl-code">; </span><span class="hl-identifier">i</span><span class="hl-code">++</span><span class="hl-brackets">)</span><span class="hl-code"> </span><span class="hl-brackets">{</span><span class="hl-code">
    </span><span class="hl-identifier">funcA</span><span class="hl-brackets">(</span><span class="hl-number">1000</span><span class="hl-brackets">)</span><span class="hl-code">;
  </span><span class="hl-brackets">}</span><span class="hl-code">　　　　
  </span><span class="hl-identifier">funcB</span><span class="hl-brackets">(</span><span class="hl-number">10000</span><span class="hl-brackets">)</span><span class="hl-code">;　　
</span><span class="hl-brackets">}</span><span class="hl-code">
 
　　
</span><span class="hl-reserved">function</span><span class="hl-code"> </span><span class="hl-identifier">funcA</span><span class="hl-brackets">(</span><span class="hl-identifier">count</span><span class="hl-brackets">)</span><span class="hl-code"> </span><span class="hl-brackets">{</span><span class="hl-code">　　　　
  </span><span class="hl-reserved">for</span><span class="hl-code"> </span><span class="hl-brackets">(</span><span class="hl-reserved">var</span><span class="hl-code"> </span><span class="hl-identifier">i</span><span class="hl-code"> = </span><span class="hl-number">0</span><span class="hl-code">; </span><span class="hl-identifier">i</span><span class="hl-code"> &lt; </span><span class="hl-identifier">count</span><span class="hl-code">; </span><span class="hl-identifier">i</span><span class="hl-code">++</span><span class="hl-brackets">)</span><span class="hl-code"> </span><span class="hl-brackets">{</span><span class="hl-brackets">}</span><span class="hl-code">　　
</span><span class="hl-brackets">}</span><span class="hl-code">
 
　　
</span><span class="hl-reserved">function</span><span class="hl-code"> </span><span class="hl-identifier">funcB</span><span class="hl-brackets">(</span><span class="hl-identifier">count</span><span class="hl-brackets">)</span><span class="hl-code"> </span><span class="hl-brackets">{</span><span class="hl-code">　　　　
  </span><span class="hl-reserved">for</span><span class="hl-code"> </span><span class="hl-brackets">(</span><span class="hl-reserved">var</span><span class="hl-code"> </span><span class="hl-identifier">i</span><span class="hl-code"> = </span><span class="hl-number">0</span><span class="hl-code">; </span><span class="hl-identifier">i</span><span class="hl-code"> &lt; </span><span class="hl-identifier">count</span><span class="hl-code">; </span><span class="hl-identifier">i</span><span class="hl-code">++</span><span class="hl-brackets">)</span><span class="hl-code"> </span><span class="hl-brackets">{</span><span class="hl-brackets">}</span><span class="hl-code">　　
</span><span class="hl-brackets">}</span><span class="hl-code">
 
</span><span class="hl-identifier">console</span><span class="hl-code">.</span><span class="hl-identifier">profile</span><span class="hl-brackets">(</span><span class="hl-quotes">'</span><span class="hl-string">性能分析器</span><span class="hl-quotes">'</span><span class="hl-brackets">)</span><span class="hl-code">;
</span><span class="hl-identifier">All</span><span class="hl-brackets">(</span><span class="hl-brackets">)</span><span class="hl-code">;　　
</span><span class="hl-identifier">console</span><span class="hl-code">.</span><span class="hl-identifier">profileEnd</span><span class="hl-brackets">(</span><span class="hl-brackets">)</span><span class="hl-code">;</span></div>
</div>
<br>
<a target="_blank" href="https://c.runoob.com/codedemo/3844" class="tryitbtn" rel="noopener noreferrer">尝试一下 »</a>
</div>
<p><img decoding="async" src="//www.runoob.com/wp-content/uploads/2017/09/CF8B1E81-6DE0-4AAC-B7E9-69E5C14F1EC0.jpg"></p>				</div>
			</div>
			<div class="previous-next-links">
			<div class="previous-design-link">← <a href="../w3cnote/linux-useful-command.html" rel="prev"> Linux 需要掌握的一些命令</a> </div>
			<div class="next-design-link"><a href="../w3cnote/python-round-func-note.html" rel="next"> Python 中关于 round 函数的小坑</a> →</div>
			</div>
						<div class="article-heading-ad" id="w3cnote-ad728">
			<script async src=""></script>
			<!-- 移动版 自动调整 -->
			<ins class="adsbygoogle"
			     style="display:inline-block;min-width:300px;max-width:970px;width:100%;height:90px"
			     data-ad-client="ca-pub-5751451760833794"
			     data-ad-slot="1691338467"
			     data-ad-format="horizontal"></ins>
			<script>
			(adsbygoogle = window.adsbygoogle || []).push({});
			</script>
			</div>
			<style>
@media screen and (max-width: 768px) {
	#w3cnote-ad728 {
		display: none;
	}
}
p.note-author {
    border-bottom: 1px solid #ddd;
    font-size: 18px;
    font-weight: bold;
    color: #78a15a;
    padding-bottom: 2px;
    margin-bottom: 4px;
}
</style>
<script>
var aid = 19163;
</script>
	</div>
		
	</div>
	<div class="listcol last right-column">




<!--
	<div class="tab tab-light-blue"> 订阅</div>
	<div class="sidebar-box">
		<div class="socialicons">
			<a href="../feed" class="rss">RSS 订阅</a>
		
			<form action="//list.qq.com/cgi-bin/qf_compose_send" method="post">
			<input type="hidden" value="qf_booked_feedback" name="t">
			<input type="hidden" value="4b67b6b6c1f5e792559940cab4aebb8f1126fba880bff1a8" name="id">
			<input class="placeholder" id="feed_email" name="to" value="输入邮箱 订阅笔记" autocomplete="off">
			<input type="submit" value="订阅" class="btn btn-primary">
			</form>
		
		</div>
 
	</div>
-->	



<!--
	<div class="sidebar-box cate-list">
	<div class="sidebar-box recommend-here list-link">
			<a href="javascript:void(0);" style="font-size: 16px; color:#64854c;font-weight:bold;">笔记列表</a>
		</div>

 

</div>
-->

	 <div class="sidebar-box cate-list">
		 		

	 	<div class="sidebar-box recommend-here list-link">
			<a href="javascript:void(0);" style="font-size: 16px; color:#64854c;font-weight:bold;">教程列表</a>
		</div>
		
		<div class="cate-items"> 
				<a href="../ado">ADO 教程</a>
	<a href="../ajax">Ajax 教程</a>
	<a href="../android">Android 教程</a>
	<a href="../angularjs2">Angular2 教程</a>
	<a href="../angularjs">AngularJS 教程</a>
	<a href="../appml">AppML 教程</a>
	<a href="../asp">ASP 教程</a>
	<a href="../aspnet">ASP.NET 教程</a>
	<a href="../bootstrap">Bootstrap 教程</a>
	<a href="../bootstrap4">Bootstrap4 教程</a>
	<a href="../bootstrap5">Bootstrap5 教程</a>
	<a href="../cprogramming">C 教程</a>
	<a href="../csharp">C# 教程</a>
	<a href="../cplusplus">C++ 教程</a>
	<a href="../chartjs">Chart.js 教程</a>
	<a href="../cssref">CSS 参考手册</a>
	<a href="../css">CSS 教程</a>
	<a href="../css3">CSS3 教程</a>
	<a href="../django">Django 教程</a>
	<a href="../docker">Docker 教程</a>
	<a href="../dtd">DTD 教程</a>
	<a href="../echarts">ECharts 教程</a>
	<a href="../eclipse">Eclipse 教程</a>
	<a href="../firebug">Firebug 教程</a>
	<a href="../font-awesome">Font Awesome 图标</a>
	<a href="../foundation">Foundation 教程</a>
	<a href="../git">Git 教程</a>
	<a href="../go">Go 语言教程</a>
	<a href="../googleapi">Google 地图 API 教程</a>
	<a href="../highcharts">Highcharts 教程</a>
	<a href="../htmldom">HTML DOM 教程</a>
	<a href="../tags">HTML 参考手册</a>
	<a href="../charsets">HTML 字符集</a>
	<a href="../html">HTML 教程</a>
	<a href="../http">HTTP 教程</a>
	<a href="../ionic">ionic 教程</a>
	<a href="../ios">iOS 教程</a>
	<a href="../java">Java 教程</a>
	<a href="../jsref">JavaScript 参考手册</a>
	<a href="../js">Javascript 教程</a>
	<a href="../jeasyui">jQuery EasyUI 教程</a>
	<a href="../jquerymobile">jQuery Mobile 教程</a>
	<a href="../jqueryui">jQuery UI 教程</a>
	<a href="../jquery">jQuery 教程</a>
	<a href="../json">JSON 教程</a>
	<a href="../jsp">JSP 教程</a>
	<a href="../julia">Julia 教程</a>
	<a href="../kotlin">Kotlin 教程</a>
	<a href="../linux">Linux 教程</a>
	<a href="../lua">Lua 教程</a>
	<a href="../markdown">Markdown 教程</a>
	<a href="../matplotlib">Matplotlib 教程</a>
	<a href="../maven">Maven 教程</a>
	<a href="../memcached">Memcached 教程</a>
	<a href="../mongodb">MongoDB 教程</a>
	<a href="../mysql">MySQL 教程</a>
	<a href="../nodejs">Node.js 教程</a>
	<a href="../numpy">NumPy 教程</a>
	<a href="../pandas">Pandas 教程</a>
	<a href="../perl">Perl 教程</a>
	<a href="../php">PHP 教程</a>
	<a href="../postgresql">PostgreSQL 教程</a>
	<a href="../python3">Python 3 教程</a>
	<a href="../python">Python 基础教程</a>
	<a href="../r">R 教程</a>
	<a href="../rdf">RDF 教程</a>
	<a href="../react">React 教程</a>
	<a href="../redis">Redis 教程</a>
	<a href="../rss">RSS 教程</a>
	<a href="../ruby">Ruby 教程</a>
	<a href="../rust">Rust 教程</a>
	<a href="../sass">Sass 教程</a>
	<a href="../scala">Scala 教程</a>
	<a href="../scipy">SciPy 教程</a>
	<a href="../servlet">Servlet 教程</a>
	<a href="../soap">SOAP 教程</a>
	<a href="../sql">SQL 教程</a>
	<a href="../sqlite">SQLite 教程</a>
	<a href="../svg">SVG 教程</a>
	<a href="../svn">SVN 教程</a>
	<a href="../swift">Swift 教程</a>
	<a href="../tcpip">TCP/IP 教程</a>
	<a href="../typescript">TypeScript 教程</a>
	<a href="../vbscript">VBScript 教程</a>
	<a href="../vue2">Vue.js 教程</a>
	<a href="../vue3">Vue3 教程</a>
	<a href="../w3c">W3C 教程</a>
	<a href="../webservices">Web Service 教程</a>
	<a href="../wsdl">WSDL 教程</a>
	<a href="../xlink">XLink 教程</a>
	<a href="../dom">XML DOM 教程</a>
	<a href="../schema">XML Schema 教程</a>
	<a href="../xml">XML 教程</a>
	<a href="../xpath">XPath 教程</a>
	<a href="../xquery">XQuery 教程</a>
	<a href="../xslfo">XSLFO 教程</a>
	<a href="../xsl">XSLT 教程</a>
	<a href="../data-structures">数据结构</a>
	<a href="../regexp">正则表达式</a>
	<a href="../quiz">测验</a>
	<a href="../browsers">浏览器</a>
	<a href="../quality">网站品质</a>
	<a href="../web">网站建设指南</a>
	<a href="../hosting">网站服务器教程</a>
	<a href="../design-pattern">设计模式</a>
			
		</div> 
		 	 </div>
</div>
	</div>
</div>


<!-- 底部 -->
<div id="footer" class="mar-t50">
   <div class="runoob-block">
    <div class="runoob cf">
     <dl>
      <dt>
       在线实例
      </dt>
      <dd>
       &middot;<a target="_blank" href="../html/html-examples.html">HTML 实例</a>
      </dd>
      <dd>
       &middot;<a target="_blank" href="../css/css-examples.html">CSS 实例</a>
      </dd>
      <dd>
       &middot;<a target="_blank" href="../js/js-examples.html">JavaScript 实例</a>
      </dd>
      <dd>
       &middot;<a target="_blank" href="../ajx/ajax-examples.html">Ajax 实例</a>
      </dd>
       <dd>
       &middot;<a target="_blank" href="../jquery/jquery-examples.html">jQuery 实例</a>
      </dd>
      <dd>
       &middot;<a target="_blank" href="../xml/xml-examples.html">XML 实例</a>
      </dd>
      <dd>
       &middot;<a target="_blank" href="../java/java-examples.html">Java 实例</a>
      </dd>
     
     </dl>
     <dl>
      <dt>
      字符集&工具
      </dt>
      <dd>
       &middot; <a target="_blank" href="../charsets/html-charsets.html">HTML 字符集设置</a>
      </dd>
      <dd>
       &middot; <a target="_blank" href="../tags/html-ascii.html">HTML ASCII 字符集</a>
      </dd>
     <dd>
       &middot; <a target="_blank" href="https://c.runoob.com/front-end/6939/">JS 混淆/加密</a>
      </dd> 
      <dd>
       &middot; <a target="_blank" href="https://c.runoob.com/front-end/6232/">PNG/JPEG 图片压缩</a>
      </dd>
      <dd>
       &middot; <a target="_blank" href="../tags/html-colorpicker.html">HTML 拾色器</a>
      </dd>
      <dd>
       &middot; <a target="_blank" href="..//c.runoob.com/front-end/53">JSON 格式化工具</a>
      </dd>
      <dd>
       &middot; <a target="_blank" href="..//c.runoob.com/front-end/6680/">随机数生成器</a>
      </dd>
     </dl>
     <dl>
      <dt>
       最新更新
      </dt>
                   <dd>
       &middot;
      <a href="../matplotlib/matplotlib-imread.html" title="Matplotlib imread() 方法">Matplotlib imre...</a>
      </dd>
              <dd>
       &middot;
      <a href="../matplotlib/matplotlib-imsave.html" title="Matplotlib imsave() 方法">Matplotlib imsa...</a>
      </dd>
              <dd>
       &middot;
      <a href="../matplotlib/matplotlib-imshow.html" title="Matplotlib imshow() 方法">Matplotlib imsh...</a>
      </dd>
              <dd>
       &middot;
      <a href="../matplotlib/matplotlib-hist.html" title="Matplotlib 直方图">Matplotlib 直方图</a>
      </dd>
              <dd>
       &middot;
      <a href="../python3/python-func-object.html" title="Python object() 函数">Python object()...</a>
      </dd>
              <dd>
       &middot;
      <a href="../python3/python-ai-draw.html" title="Python AI 绘画">Python AI 绘画</a>
      </dd>
              <dd>
       &middot;
      <a href="../w3cnote/cursor-editor.html" title="神辅助 Cursor 编辑器，加入 GPT-4 让编码更轻松！">神辅助 Cursor ...</a>
      </dd>
             </dl>
     <dl>
      <dt>
       站点信息
      </dt>
      <dd>
       &middot;
       <a target="_blank" href="mailto:admin@runoob.com" rel="external nofollow">意见反馈</a>
       </dd>
      <dd>
       &middot;
      <a target="_blank" href="../disclaimer">免责声明</a>
       </dd>
      <dd>
       &middot;
       <a target="_blank" href="../aboutus">关于我们</a>
       </dd>
      <dd>
       &middot;
      <a target="_blank" href="../archives">文章归档</a>
      </dd>
    
     </dl>
    
     <div class="search-share">
      <div class="app-download">
        <div>
         <strong>关注微信</strong>
        </div>
      </div>
      <div class="share">
      <img width="128" height="128" src="/wp-content/themes/runoob/assets/images/qrcode.png" />
       </div>
     </div>
     
    </div>
   </div>
   <div class="w-1000 copyright">
     Copyright &copy; 2013-2023    <strong><a href="../" target="_blank">菜鸟教程</a></strong>&nbsp;
    <strong><a href="../" target="_blank">runoob.com</a></strong> All Rights Reserved. 备案号：<a target="_blank" rel="nofollow" href="https://beian.miit.gov.cn/">闽ICP备15012807号-1</a>
   </div>
  </div>
  <div class="fixed-btn">
    <a class="go-top" href="javascript:void(0)" title="返回顶部"> <i class="fa fa-angle-up"></i></a>
    <a class="qrcode"  href="javascript:void(0)" title="关注我们"><i class="fa fa-qrcode"></i></a>
    <a class="writer" style="display:none" href="javascript:void(0)"   title="标记/收藏"><i class="fa fa-star" aria-hidden="true"></i></a>
    <!-- qrcode modal -->
    <div id="bottom-qrcode" class="modal panel-modal hide fade in">
      <h4>微信关注</h4>
      <div class="panel-body"><img alt="微信关注" width="128" height="128" src="/wp-content/themes/runoob/assets/images/qrcode.png"></div> 
    </div>
  </div>

 <div style="display:none;">
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-84264393-2"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());

  gtag('config', 'UA-84264393-2');
</script>
<script>
var _hmt = _hmt || [];
(function() {
  var hm = document.createElement("script");
  hm.src = "https://hm.baidu.com/hm.js?3eec0b7da6548cf07db3bc477ea905ee";
  var s = document.getElementsByTagName("script")[0]; 
  s.parentNode.insertBefore(hm, s);
})();
</script>

</div>
<script>
window.jsui={
    www: 'https://www.runoob.com',
    uri: 'https://www.runoob.com/wp-content/themes/runoob'
};
</script>

<script src=""></script>
<script src=""></script>

</body>
</html>